package com.juli.school.service.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * @Description: 闲置交易类型
 * @author gaoxiang
 * @date 2018年1月3日 下午6:52:08
 */ 
public enum EnumErType {
	
	multimedia("multimedia","图书音像"),
	dress("dress","包鞋衣物"),
	digital("digital","电子数码"),
	ticket("ticket","卡券票务"),
	living("living","生活用品"),
	other("other","其他小物");
	
	public String code;
	
	public String module;

	private EnumErType(String code, String module) {
		this.code = code;
		this.module = module;
	}
	
	public static EnumErType codeOf(String code) {
		return Arrays.asList(EnumErType.values()).stream().filter(enumModule -> enumModule.code.equals(code)).findFirst().orElse(null);
	}

	public static Map<String,String> list() {
		Map<String,String> map = Maps.newHashMap();
		ArrayList<EnumErType> list = Lists.newArrayList(EnumErType.values());
		for(EnumErType enumErType : list) {
			map.put(enumErType.code, enumErType.module);
		}
		return map;
	}
	
}
